#include "realvariable.h"

RealVariable::RealVariable() : RealOperation() {
    nameOfVariable='x';
    varID=0;
}

RealVariable::RealVariable(RealVariable& myRealVariable) {
    nameOfVariable=myRealVariable.getSign();
    varID=myRealVariable.varID;
}

RealVariable::RealVariable(const char& myName, const unsigned int& myID) : RealOperation() {
    nameOfVariable=myName;
    varID=myID;
}

RealVariable::~RealVariable() {
}

char RealVariable::getSign() {
    return nameOfVariable;
}

void RealVariable::evaluateMe(LinkedList<double>& evaluationStack, const double* positionArray) {
    evaluationStack.addAtEnd(*(new double(positionArray[varID])));
}

bool operator==(RealVariable& v1, RealVariable& v2) {
	return (v1.nameOfVariable==v2.nameOfVariable) && (v1.varID==v2.varID);
}

void RealVariable::createHumanReadeableToString(LinkedList<std::string>& toStringStack) {
    toStringStack.addAtEnd(DoubleToString::cts(getSign()));
}
